home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------cominck routine begins--------------------------+
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 35
- ;
- ; NAME COMINCK
- ; ROUTINE FOR COMMUNICATIONS LINE INPUT CHECK
- ;
- ; FUNCTION: This routine checks but does not wait for input from one of
- ; the two serial communications lines.
- ; INPUT: Upon entry DX contains the unit number (0 for comm1: and 1 for
- ; comm2:). During the routine, input is from the specified communications
- ; line.
- ; OUTPUT: If a byte is available, the routine returns with the flag
- ; condition NZ and the byte in AL. If no byte is available then the
- ; routine returns with the flag condition Z and AL is meaningless.
- ; REGISTERS USED: AH is modified.. DX is used for input and AL is used
- ; for output.
- ; SEGMENTS REFERENCED: During the routine the system data segment is
- ; referenced.
- ; ROUTINES CALLED: None
- ; SPECIAL NOTES: None
- ;
- ; ROUTINE TO CHECK FOR INPUT FROM A COMMUNICATIONS LINE
- ;
- cominck proc far
- ;
- push ds ; save registers
- push dx
- push si
- ;
- mov si,dx ; look up address of comm line
- add si,si ; double to index into table
- mov dx,40h ; segment of table
- mov ds,dx ; set data segment to this table
- mov dx,[si] ; now get it
- add dx,5 ; line status
- in al,dx ; get it
- test al,1 ; receive buffer full ?
- jz cominckexit ; yes, it is
- ;
- mov dx,[si] ; data register
- in al,dx ; get data
- ;
- cominckexit:
- ;
- pop si ; restore registers
- pop dx
- pop ds
- ;
- ret ; return
- ;
- cominck endp
- ;-------------------------cominck routine ends---------------------------+